//
//  MainView.swift
//  Example
//
//  Created by xx on 2025/3/24.
//

import UIKit
import FastSwiftSDK

class MainCollectionViewCell: UICollectionViewCell {
    
    private lazy var lbl_title : FastLabel = {
        let lbl =  FastLabel.init()
        lbl.textAlignment = .center
        lbl.font = .bold(16)
        self.addSubview(lbl)
        return  lbl
    } ()
    private lazy var img_logo : UIImageView = {
        let img =  UIImageView.init()
        self.addSubview(img)
        return  img
    } ()
    func setData(_ data:Dictionary<String,Any>) {
        if let img = data.string("img"){
            img_logo.image = kImage(img)
        }
        if let title = data.string("title"){
            lbl_title.text = title
        }
       
    }
    override func layoutSubviews() {
        self.img_logo.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.centerX.equalToSuperview()
            make.size.equalTo(100)
        }
        self.lbl_title.snp.makeConstraints { make in
            make.top.equalTo(self.img_logo.snp.bottom)
            make.left.bottom.right.equalToSuperview()
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        // 设置背景颜色和圆角
        self.backgroundColor = .white
        self.layer.cornerRadius = 10
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
